<%@page import="com.mongodb.BasicDBObject"%>
<%@page import="com.mongodb.DBObject"%>
<%@page import="com.mongodb.DBCursor"%>
<%@page import="com.mongodb.DBCollection"%>
<%@ page import="devboard.dbutil.MongoUtil" %>


<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

    
<!DOCTYPE html>
<html>
	<head>
		<link rel="icon" type="image/png" href="favicon.png" >
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>devboard-Planning</title>
		<link rel="stylesheet" href="css/Global.css" type="text/css">
		<link rel="stylesheet" href="css/Planning.css" type="text/css">
		<script type="text/javascript" src="js/Planning.js"></script>
	</head>
	<body>
		
			<%
			DBCollection tempTasks=MongoUtil.getCollection("TempTasks");
			if(tempTasks.count()>0){ %>
			<div id="content" class="st">
    			<table id="taskList">
				<tr>
					<th>check</th><th>sub id</th><th>team</th><th>task name</th>
						<th>service type</th><th>estimate</th>
				</tr>
					<%
					DBCursor cursor=tempTasks.find();
					while(cursor.hasNext()){
						DBObject task=cursor.next();%>
						<tr>
							<td><input name="<%=task.get("_id") %>" onclick="estimateSH(this.parentNode.parentNode,this)" <%=task.get("checked") %> type="checkbox"></td>
							<td><%=task.get("subId") %></td>
							<td><%=task.get("project") %></td>
							<td><a href="<%=task.get("link") %>" target="_blank"><%=task.get("name") %></a></td>
							<td><%=task.get("serviceType") %></td>
							<td><input style="visibility:<%if(!task.get("checked").equals("")){out.write("visible");}else{out.write("hidden");}%>" 
									type="text" size="1" value="<%=task.get("estimate") %>"></td>
						</tr>
					<%} %>
				</table>
				<br />
			</div>
			<div id="buttonsBar">
				<button onclick="saveCurrentState()">save</button>
				<button onclick="sendEmail()">send</button>
				<button onclick="addToBoard()">add to board</button>
				<button onclick="deleteChecked()">delete</button>
			</div>
			<%}else{%>
				<div id="content" class="st">
					<form action="PlanningHandler" method="post" enctype="multipart/form-data">
						<input name="data" type="file"><br>
						<input type="submit">
					</form>
				</div>
			<%}%>
	</body>
</html>